public class MyRunnable implements Runnable{
    @Override
    public void run() {
        for (int i = 0;i <5 ;i++){
            System.out.println(Thread.currentThread().getName()+":"+i);
            try {
                Thread.currentThread().sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) {
        Thread t = new Thread(new MyRunnable(),"Thread1");
        t.run();
        System.out.println("One.");

        Thread s = new Thread(new MyRunnable(),"Thread2");
        s.run();
        System.out.println("Two.");
    }
}
